ARD2  1.00 for Rev B. Hardware
Airbag Reference Demonstrator using MPC5604P
freemaster_private.h File Reference

FreeMASTER driver private declarations, used internally by the driver. More...

Go to the source code of this file.

Defines

#define NULL   ((void *) 0)
#define FMSTR_TRUE   (1U)
#define FMSTR_FALSE   (0U)
#define FMSTR_INLINE   static
#define FMSTR_MACROCODE_BEGIN()   do{
#define FMSTR_MACROCODE_END()   }while(0)
#define FMSTR_UNUSED(sym)   ((sym),0)
#define FMSTR_USE_SERIAL   0
#define FMSTR_COMM_BUFFER_SIZE   0

Functions

FMSTR_BOOL FMSTR_InitSerial (void)
 Serial communication initialization.
void FMSTR_SendResponse (FMSTR_BPTR pMessageIO, FMSTR_SIZE8 nLength)
 Finalize transmit buffer before transmitting.
void FMSTR_ProcessSCI (void)
 Handle SCI communication (both TX and RX)
void FMSTR_ProcessJTAG (void)
FMSTR_BOOL FMSTR_Tx (FMSTR_U8 *pTxChar)
 Output buffer transmission.
FMSTR_BOOL FMSTR_Rx (FMSTR_U8 nRxChar)
 Handle received character.
FMSTR_BOOL FMSTR_ProtocolDecoder (FMSTR_BPTR pMessageIO)
 Decodes the FreeMASTER protocol and calls appropriate handlers.
FMSTR_BPTR FMSTR_GetBoardInfo (FMSTR_BPTR pMessageIO)
 Handling GETINFO or GETINFO_BRIEF.
FMSTR_BPTR FMSTR_ReadMem (FMSTR_BPTR pMessageIO)
 Handling READMEM and READMEM_EX commands.
FMSTR_BPTR FMSTR_ReadVar (FMSTR_BPTR pMessageIO, FMSTR_SIZE8 nSize)
 Handling READVAR and READVAR_EX commands (for all sizes 1,2,4)
FMSTR_BPTR FMSTR_WriteMem (FMSTR_BPTR pMessageIO)
 Handling WRITEMEM and WRITEMEM_EX commands.
FMSTR_BPTR FMSTR_WriteVar (FMSTR_BPTR pMessageIO, FMSTR_SIZE8 nSize)
 Handling WRITEVAR command.
FMSTR_BPTR FMSTR_WriteVarMask (FMSTR_BPTR pMessageIO, FMSTR_SIZE8 nSize)
 Handling WRITEVARMASK command.
FMSTR_BPTR FMSTR_WriteMemMask (FMSTR_BPTR pMessageIO)
 Handling WRITEMEMMASK and WRITEMEMMASK_EX commands.
void FMSTR_InitAppCmds (void)
 Initialize app.cmds interface.
FMSTR_BPTR FMSTR_StoreAppCmd (FMSTR_BPTR pMessageIO)
 Handling SANDAPPCMD command.
FMSTR_BPTR FMSTR_GetAppCmdStatus (FMSTR_BPTR pMessageIO)
 Handling GETAPPCMDSTS command.
FMSTR_BPTR FMSTR_GetAppCmdRespData (FMSTR_BPTR pMessageIO)
 Handling GETAPPCMDDATA command.
void FMSTR_InitScope (void)
 Scope Initialization.
FMSTR_BPTR FMSTR_SetUpScope (FMSTR_BPTR pMessageIO)
 Handling SETUPSCOPE and SETUPSCOPE_EX command.
FMSTR_BPTR FMSTR_ReadScope (FMSTR_BPTR pMessageIO)
 Handling READSCOPE command.
void FMSTR_InitRec (void)
 Recorder Initialization.
FMSTR_BPTR FMSTR_SetUpRec (FMSTR_BPTR pMessageIO)
 Handling SETUPREC and SETUPREC_EX commands.
FMSTR_BPTR FMSTR_StartRec (FMSTR_BPTR pMessageIO)
 Handling STARTREC command.
FMSTR_BPTR FMSTR_StopRec (FMSTR_BPTR pMessageIO)
 Handling STOPREC command.
FMSTR_BPTR FMSTR_GetRecStatus (FMSTR_BPTR pMessageIO)
 Handling GETRECSTS command.
FMSTR_BPTR FMSTR_GetRecBuff (FMSTR_BPTR pMessageIO)
 Handling GETRECBUFF and GETRECBUFF_EX command.
FMSTR_BOOL FMSTR_IsInRecBuffer (FMSTR_ADDR nAddr, FMSTR_SIZE8 nSize)
 Check wether given memory region is inside the recorder buffer.
FMSTR_SIZE FMSTR_GetRecBuffSize (void)
 Get recorder memory size.
void FMSTR_InitTsa (void)
 TSA Initialization.
FMSTR_BPTR FMSTR_GetTsaInfo (FMSTR_BPTR pMessageIO)
 Handling GETTSAINFO and GETTSAINFO_EX command.
FMSTR_BPTR FMSTR_GetStringLen (FMSTR_BPTR pMessageIO)
 Handling GETSTRLEN and GETSTRLEN_EX commands.
FMSTR_BOOL FMSTR_CheckTsaSpace (FMSTR_ADDR nAddr, FMSTR_SIZE8 nSize, FMSTR_BOOL bWriteAccess)
 Check wether given memory region is "safe" (covered by TSA)
FMSTR_U16 FMSTR_StrLen (FMSTR_ADDR nAddr)
 Private inline implementation of "strlen" used by TSA and Pipes.
void FMSTR_InitSfio (void)
FMSTR_BPTR FMSTR_SfioFrame (FMSTR_BPTR pMessageIO)
FMSTR_BPTR FMSTR_SfioGetResp (FMSTR_BPTR pMessageIO)
void FMSTR_InitPipes (void)
FMSTR_BPTR FMSTR_PipeFrame (FMSTR_BPTR pMessageIO)
void FMSTR_InitCan (void)
void FMSTR_SetCanCmdID (FMSTR_U32 canID)
void FMSTR_SetCanRespID (FMSTR_U32 canID)
FMSTR_BOOL FMSTR_TxCan (void)
FMSTR_BOOL FMSTR_RxCan (void)
void FMSTR_ProcessCanRx (void)
void FMSTR_ProcessCanTx (void)
void FMSTR_InitPDBdm (void)

Detailed Description

FreeMASTER driver private declarations, used internally by the driver.

Version:
1.0.52.0
Date:
Aug-25-2011

Function Documentation

FMSTR_BOOL FMSTR_CheckTsaSpace ( FMSTR_ADDR  dwAddr,
FMSTR_SIZE8  nSize,
FMSTR_BOOL  bWriteAccess 
)

Check wether given memory region is "safe" (covered by TSA)

Parameters:
dwAddr- address of the memory to be checked
nSize- size of the memory to be checked
bWriteAccess- write access is required
Returns:
This function returns non-zero if user space is safe
FMSTR_BPTR FMSTR_GetAppCmdRespData ( FMSTR_BPTR  pMessageIO)

Handling GETAPPCMDDATA command.

Parameters:
pMessageIO- original command (in) and response buffer (out)
Returns:
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)
FMSTR_BPTR FMSTR_GetAppCmdStatus ( FMSTR_BPTR  pMessageIO)

Handling GETAPPCMDSTS command.

Parameters:
pMessageIO- original command (in) and response buffer (out)
Returns:
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)
Note:
The callback-registerred commands are processed at the moment the PC tries to get the result for the first time. At this moment, we are sure the PC already got the command delivery packet acknowledged.
FMSTR_BPTR FMSTR_GetBoardInfo ( FMSTR_BPTR  pMessageIO)

Handling GETINFO or GETINFO_BRIEF.

Parameters:
pMessageIO- original command (in) and response buffer (out)
Returns:
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)
FMSTR_BPTR FMSTR_GetRecBuff ( FMSTR_BPTR  pMessageIO)

Handling GETRECBUFF and GETRECBUFF_EX command.

Parameters:
pMessageIO- original command (in) and response buffer (out)
Returns:
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)

This function returns recorder buffer information

FMSTR_SIZE FMSTR_GetRecBuffSize ( void  )

Get recorder memory size.

Returns:
Recorder memory size in native sizeof units (=bytes on most platforms)
FMSTR_BPTR FMSTR_GetRecStatus ( FMSTR_BPTR  pMessageIO)

Handling GETRECSTS command.

Parameters:
pMessageIO- original command (in) and response buffer (out)
Returns:
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)

This function returns current recorder status

FMSTR_BPTR FMSTR_GetStringLen ( FMSTR_BPTR  pMessageIO)

Handling GETSTRLEN and GETSTRLEN_EX commands.

Parameters:
pMessageIO- original command (in) and response buffer (out)
Returns:
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)
FMSTR_BPTR FMSTR_GetTsaInfo ( FMSTR_BPTR  pMessageIO)

Handling GETTSAINFO and GETTSAINFO_EX command.

Parameters:
pMessageIO- original command (in) and response buffer (out)
Returns:
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)
FMSTR_BOOL FMSTR_IsInRecBuffer ( FMSTR_ADDR  dwAddr,
FMSTR_SIZE8  nSize 
)

Check wether given memory region is inside the recorder buffer.

Parameters:
dwAddr- address of the memory to be checked
wSize- size of the memory to be checked
Returns:
This function returns non-zero if user space is in recorder buffer

This function is called as a part of TSA-checking process when the PC host is requesting memory contents

void FMSTR_ProcessSCI ( void  )

Handle SCI communication (both TX and RX)

This function checks the SCI flags and calls the Rx and/or Tx functions

Note:
This function can be called either from SCI ISR or from the polling routine
FMSTR_BOOL FMSTR_ProtocolDecoder ( FMSTR_BPTR  pMessageIO)

Decodes the FreeMASTER protocol and calls appropriate handlers.

Parameters:
pMessageIO- message in/out buffer
Returns:
TRUE if frame was valid and any output was generated to IO buffer

This Function decodes given message and invokes proper command handler which fills in the response. The response transmission is initiated in this call as well.

FMSTR_BPTR FMSTR_ReadMem ( FMSTR_BPTR  pMessageIO)

Handling READMEM and READMEM_EX commands.

Parameters:
pMessageIO- original command (in) and response buffer (out)
Returns:
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)
FMSTR_BPTR FMSTR_ReadScope ( FMSTR_BPTR  pMessageIO)

Handling READSCOPE command.

Parameters:
pMessageIO- original command (in) and response buffer (out)
Returns:
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)
FMSTR_BPTR FMSTR_ReadVar ( FMSTR_BPTR  pMessageIO,
FMSTR_SIZE8  nSize 
)

Handling READVAR and READVAR_EX commands (for all sizes 1,2,4)

Parameters:
pMessageIO- original command (in) and response buffer (out)
Returns:
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)
FMSTR_BOOL FMSTR_Rx ( FMSTR_BCHR  nRxChar)

Handle received character.

Parameters:
nRxCharThe character to be processed

Handle the character received and -if the message is complete- call the protocol decode routine.

void FMSTR_SendResponse ( FMSTR_BPTR  pResponse,
FMSTR_SIZE8  nLength 
)

Finalize transmit buffer before transmitting.

Parameters:
nLength- response length (1 for status + data length)

This Function takes the data already prepared in the transmit buffer (inlcuding the status byte). It computes the check sum and kicks on tx.

FMSTR_BPTR FMSTR_SetUpRec ( FMSTR_BPTR  pMessageIO)

Handling SETUPREC and SETUPREC_EX commands.

Parameters:
pMessageIO- original command (in) and response buffer (out)
Returns:
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)
FMSTR_BPTR FMSTR_SetUpScope ( FMSTR_BPTR  pMessageIO)

Handling SETUPSCOPE and SETUPSCOPE_EX command.

Parameters:
pMessageIO- original command (in) and response buffer (out)
Returns:
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)
FMSTR_BPTR FMSTR_StartRec ( FMSTR_BPTR  pMessageIO)

Handling STARTREC command.

Parameters:
pMessageIO- original command (in) and response buffer (out)
Returns:
As all command handlers, the return value should be the length of the response filled into the buffer (including status byte)

This function starts recording (initializes internal recording variables and flags)

FMSTR_BPTR FMSTR_StopRec ( FMSTR_BPTR  pMessageIO)

Handling STOPREC command.

Parameters:
pMessageIO- original command (in) and response buffer (out)
Returns:
As all command handlers, the return value should be the length of the response filled into the buffer (including status byte)

This function stops recording (same as manual trigger)

FMSTR_BPTR FMSTR_StoreAppCmd ( FMSTR_BPTR  pMessageIO)

Handling SANDAPPCMD command.

Parameters:
pMessageIO- original command (in) and response buffer (out)
Returns:
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)
FMSTR_BOOL FMSTR_Tx ( FMSTR_U8 *  pTxChar)

Output buffer transmission.

Parameters:
pTxCharThe character to be transmit

get ready buffer(prepare data to send)

FMSTR_BPTR FMSTR_WriteMem ( FMSTR_BPTR  pMessageIO)

Handling WRITEMEM and WRITEMEM_EX commands.

Parameters:
pMessageIO- original command (in) and response buffer (out)
Returns:
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)
FMSTR_BPTR FMSTR_WriteMemMask ( FMSTR_BPTR  pMessageIO)

Handling WRITEMEMMASK and WRITEMEMMASK_EX commands.

Parameters:
pMessageIO- original command (in) and response buffer (out)
Returns:
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)
FMSTR_BPTR FMSTR_WriteVar ( FMSTR_BPTR  pMessageIO,
FMSTR_SIZE8  nSize 
)

Handling WRITEVAR command.

Parameters:
pMessageIO- original command (in) and response buffer (out)
nSize- variable size
Returns:
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)
FMSTR_BPTR FMSTR_WriteVarMask ( FMSTR_BPTR  pMessageIO,
FMSTR_SIZE8  nSize 
)

Handling WRITEVARMASK command.

Parameters:
pMessageIO- original command (in) and response buffer (out)
nSize- variable size
Returns:
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)